package com.googlecode.chigs.web.doku.version;

import com.googlecode.chigs.domain.Product;
import com.googlecode.chigs.domain.Version;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
import org.apache.wicket.model.IModel;

public abstract class EditOrCreateVersionWindow extends ModalWindow {

	public EditOrCreateVersionWindow(String id, IModel<Version> model, Product product) {
		super(id);
		setInitialWidth(450);
        setInitialHeight(300);
        setContent(new EditOrCreateVersionPanel(this.getContentId(), model, product){
			@Override
			protected void afterCanel(AjaxRequestTarget target) {
				EditOrCreateVersionWindow.this.afterCanel(target);				
			}

			@Override
			protected void afterSubmit(AjaxRequestTarget target, IModel<Version> model) {
				EditOrCreateVersionWindow.this.afterSubmit(target, model);
			}
        });
	}

	protected abstract  void afterSubmit(AjaxRequestTarget target, IModel<Version> model);

	protected abstract  void afterCanel(AjaxRequestTarget target);
	
}
